import { createApp } from 'vue'
import { createStore } from 'vuex'

import MacOS from './MacOS'
let macOS = createApp(MacOS)

import "virtual:windi.css";
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import zhCn from 'element-plus/es/locale/lang/zh-cn'
macOS.use(ElementPlus, {
    locale: zhCn,
})

for (const [name, component] of Object.entries(ElementPlusIconsVue)) {
  
  macOS.component(name, component);
  
}

import moment from 'moment';

moment.locale('zh-cn');

import * as IconPark from '@icon-park/vue-next';
import '@icon-park/vue-next/styles/index.css';
// // 注册IconPark组件
for (const [key, component] of Object.entries(IconPark)) {
//console.log('key:', key)
if(key != 'el-form-item')
  {
macOS.component('IP_'+key, component);
}
}
// 引入VueOfficeDocx组件
import VueOfficeDocx from '@vue-office/docx';
// 引入相关样式
import '@vue-office/docx/lib/index.css';

import VueOfficeExcel from '@vue-office/excel';
// 引入相关样式
import '@vue-office/excel/lib/index.css';

import VueOfficePdf from '@vue-office/pdf';

import JsonViewer from 'vue3-json-viewer';
import "@/asset/css/app.css"
import "@/asset/css/animation.css"
import "@/asset/css/iconfont.css"
import config from './config'

import "vue3-json-viewer/dist/index.css"; // 引入样式

macOS.config.globalProperties.config = config
macOS.config.globalProperties.$moment = moment;
import tool from './helper/tool'
macOS.config.globalProperties.tool = tool
import VueAMap, {initAMapApiLoader} from '@vuemap/vue-amap';
import '@vuemap/vue-amap/dist/style.css'
import AppStore from './store/App'
const store = createStore(AppStore)

import hljs from "highlight.js/lib/core";
import hljsVuePlugin from "@highlightjs/vue-plugin";
import "highlight.js/styles/atom-one-dark.css";
import javascript from "highlight.js/lib/languages/javascript";
hljs.registerLanguage("javascript", javascript);
import BaiduCalendar from "vue-baidu-calendar"



macOS.use(store)

macOS.use(VueOfficeDocx);
macOS.use(VueOfficeExcel);
macOS.use(VueOfficePdf);
macOS.use(JsonViewer);
macOS.use(hljsVuePlugin)
macOS.use(BaiduCalendar)
macOS.use(VueAMap) // 使用插件
initAMapApiLoader({ // 初始化插件
    key: '5ae2c831b8473cf9abb3ecdaa6544cc6', // 高德key
    plugin: ['AMap.Geocoder', 'AMap.PlaceSearch', 'AMap.Geolocation', 'AMap.CitySearch'], // 插件集合，根据自己的需求添加
    uiVersion: '1.0.11', // 不加会报错，加上吧
    v: '1.4.15' // 默认高德 sdk 版本为 1.4.4
  })
  // 申请的Web端（JS API）的需要写上下面这段话
  window._AMapSecurityConfig = {
    securityJsCode: '0a55645d21ffde6e5974d54c4530494d' // 高德Web端安全密钥
  }

window.macOS = macOS
macOS.mount('#app')